From ca1510177c8784c5eee2fb1d73f43f2b2dfc27fd Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 21 May 2014 14:58:50 +0200 Subject: [PATCH] texthandle: Mind the invisible area when moving the handle The handle is still centered horizontally, but the extra vertical space wasn't taken into account, leading to misplacing the dragging point (and the handle) during motion events. --- gtk/gtktexthandle.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gtk/gtktexthandle.c b/gtk/gtktexthandle.c index 226198732e..ab0495513f 100644 --- a/gtk/gtktexthandle.c +++ b/gtk/gtktexthandle.c @@ -193,14 +193,18 @@ gtk_text_handle_widget_event (GtkWidget *widget, event->motion.state & GDK_BUTTON1_MASK && priv->windows[pos].dragged) { - gint x, y, width, height; + gint x, y, width, height, handle_height; + GtkAllocation allocation; - _gtk_text_handle_get_size (handle, &width, &height); + gtk_widget_get_allocation (priv->windows[pos].widget, &allocation); + width = allocation.width; + height = allocation.height; + _gtk_text_handle_get_size (handle, NULL, &handle_height); x = event->motion.x - priv->windows[pos].dx + (width / 2); y = event->motion.y - priv->windows[pos].dy; if (pos != GTK_TEXT_HANDLE_POSITION_CURSOR) - y += height; + y += height - handle_height; y += priv->windows[pos].pointing_to.height / 2; -- 2.30.2